{% extends 'base.html' %}

{% block title %}燃料拉运管理 - 燃料结算系统{% endblock %}

{% block page_title %}燃料拉运管理{% endblock %}

{% block content %}
<div class="mb-3 d-flex justify-content-between">
    <div>
        <a href="{{ url_for('transportation.create') }}" class="btn btn-primary">
            <i class="bi bi-plus-circle me-2"></i>添加拉运记录
        </a>
        <a href="{{ url_for('transportation.summary') }}" class="btn btn-outline-secondary ms-2">
            <i class="bi bi-bar-chart me-2"></i>查看汇总
        </a>
    </div>
    <a href="{{ url_for('index') }}" class="btn btn-outline-secondary">
        <i class="bi bi-arrow-left me-2"></i>返回首页
    </a>
</div>

<div class="card">
    <div class="card-body">
        {% if transportations %}
        <div class="table-responsive">
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
                        <th>承运日期</th>
                        <th>燃料合同名称</th>
                        <th>拉运类型</th>
                        <th>拉运单价</th>
                        <th>拉运地点</th>
                        <th>拉运合同</th>
                        <th>运输单价</th>
                        <th>拉运数量</th>
                        <th>运输金额</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for transportation in transportations %}
                    <tr>
                        <td>{{ transportation.transport_date.strftime('%Y-%m') }}</td>
                        <td>{{ transportation.fuel_contract.contract_name }}</td>
                        <td>{{ transportation.transport_type }}</td>
                        <td>{{ "%.2f"|format(transportation.transport_unit_price) }}</td>
                        <td>{{ transportation.transport_location }}</td>
                        <td>{{ transportation.transport_contract }}</td>
                        <td>{{ "%.2f"|format(transportation.transportation_unit_price) }}</td>
                        <td>{{ transportation.transport_quantity }}</td>
                        <td>{{ "{:,.2f}".format(transportation.transportation_amount) }}</td>
                        <td>
                            <a href="{{ url_for('transportation.edit', id=transportation.id) }}" class="btn btn-sm btn-outline-primary">
                                <i class="bi bi-pencil"></i>
                            </a>
                            <a href="{{ url_for('transportation.delete', id=transportation.id) }}" class="btn btn-sm btn-outline-danger" onclick="return confirm('确定要删除这条记录吗？')">
                                <i class="bi bi-trash"></i>
                            </a>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        {% else %}
        <div class="alert alert-info">
            <i class="bi bi-info-circle me-2"></i>暂无燃料拉运记录，请点击"添加拉运记录"按钮添加。
        </div>
        {% endif %}
    </div>
</div>
{% endblock %} 